seh=ISO-8859-1>no 5. in/
"><DEBUG sc/puctn itlen&l.css" tefa="text/css">nn<Brolcs>n<Archilycturm>n<I t&vyals>n<DEBUG sc/puctn hn rr< rr< d s dth="20%" allgn="left>n>csaucssnkey="p"spann carchilycturm.html"rPrevesa> dr< h s dth="60%" allgn="ceccerlrPd>t II. l"><Brolcsn >csaucssnkey="n"spann c t&vyals.html"rNextesa>tn dr rr nble>
o" lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle>n>csen m="debul>no 5. in/
"><DEBUG sc/puctnh2 Optlemsuchmsuch4n classauthorann c4n classauthorannspan4n classf rsten maiChriscispan> nspan4n classsuren maiHertelcispan>amJuly 1998Tnble of Ct "eccshsb>n>cspann cdebul.htmllass=15287lrNewaOutputcSyIlaxesa>tnspan>amemeltatnspan4n classsect1>n>cspann cdebul.htmllass=15399aiThe DEBUG() Macroesa>tnspan>amemeltatnspan4n classsect1>n>cspann cdebul.htmllass=15508lrTce DEBUGADD() Macroesa>tnspan>amemeltatnspan4n classsect1>n>cspann cdebul.htmllass=15545lrTce DEBUGLVL() Macroesa>tnspan>amemeltatnspan4n classsect1>n>cspann cdebul.htmllass=15638lrNewaFuncary.sesa>tnspan>amemeltdmsuSuccesnspan4n classsect2>n>cspann cdebul.htmllass=15644">dbgtext()esa>tnspan>amemeltatnspan4n classsect2>n>cspann cdebul.htmllass=15660">dbghdr()esa>tnspan>amemeltatnspan4n classsect2>n>cspann cdebul.htmllass=15679>necessa_debul_text()esa>tnspan>amemelill Optdelill Optlemsuch4n classsect1> lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle> tfylessclear: both>n>csen m="ass=15287lresa>NewaOutputcSyIlaxesh2 Optlemsptlemsuchmsptlemsptlemsp>
osin/>syIlax usta
debulgl:
clogifile is re2veodexed
as:
o/lis l:
">
>debulfile< :== { >debulmsg< }
>debulmsg< :== >debulhdr< '\n' >debultext<
>debulhdr< :== '[' TIME ',' LEVEL ']' FILE ':' [FUNCTION] '(' LINE ')'
>debultext< :== { >debulll:e< }
>debulll:e< :== TEXT '\n'
iEXT is a strcnl o
lch>
acaivs excludl:
clrg"newll:elch>
acaiv.
LEVEL is lrg"DEBUG leselaustoce mssnPc>O(an4iut&g iucuc/ vang0
0..10).
iIME is a timestamp.
FILE is lrg"en mcostoce file il
enwhichtere debul mssnPc>Owas
gene
aced.
FUNCTION is lrg"funcary.iil
enwhichtere debul mssnPc>Owas gene
aced.
LINE is lrg"ll:elnumb ustere debul statgme.t erat
gene
acedFt e
mssnPc>.
Brolcalll,lwte ctna call"ndans is:n
A
debulgl:
clogifile is mudeFup ustdebul mssnPc>n.
Eachtdebul mssnPc>Ois mudeFup ustaaheaper ad"atext.cin/>heaper is
sep>
acydFil
enoce uextFbyca"newll:e.
in/>heaper begiesFs meauc/ timestamp ad"adebul leselaustoce
mssnPc> enclasedacnabrackets.cin/>f leen m, funcary.,aad"all:e
numb atnwhichtere mssnPc>Owas gene
acedtfollow.cin/>f leen mtis
lerminacedFbycltctly.,aad"alrg"funcary.ien mtis lerminacedFbycere
parenthesis whichttt4"ain lrg"ll:elnumb . Dependl:
cupunzt e
ommp leo,alrg"funcary.ien mtmayabeemisnlnl (itais gene
acedFbyct e
__FUNCTION__tiucro,4whichtis
not unisivsally ittu[ndexidrOdangit).
in/>mssnPc>OuextFis mudeFup ustzeroaor mo
Tell:es,ceachtlerminaced
byca"newll:e.
H/pe's eomeaex 220aoutput:o/lis l:
">
[1998/08/03 12:55:25, 1]cn ld.c:(659)
Netbiossen mscnser vdn LDI 1.9.19-prealpha stfn ed.
Copyright Andrew Tridgell"1994-1997
[1998/08/03 12:55:25, 3]cloadpd>m.c:(763)
Iniaaallzlnl globalcpd>o/tr>os
No=eclrat4iuclrg"abovd ex 220alrg"funcary.ien ms ape not lis edFon
lrg"heaper ll:e.cine 'nibecaus oce ex 220aabovd was gene
acedtDI ad
SGI Indy,aad"alrg"SGI ommp leo dossn'thsts an clrg"__FUNCTION__tiucro.
lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle> tfylessclear: both>n>csen m="ass=15399aiesa>Tce DEBUG() Macroesh2 Optlemsptlemsuchmsptlemsptlemsp>
Us ustoce DEBUG() iucrotis u chang0d. DEBUG() takys"two pd>o/tr>os.
in/ f rst is lrg"mssnPc>Olesel,alrg"second is lrg"body ustaafuncary.
call"eo
oce Debul1() funcary..
ine 'nicstuusl:
.H/pe's an
[x 220awhichtmayahelpca bit.cIf you woul"awrilyo/lis l:
">
pro f( "inis
is a %s"mssnPc>.\n", "debul> );
eo
sendaoce outputceo
stdout, mede you woul"awrily
o/lis l:
">
DEBUG( 0, ( "inis
is a %s"mssnPc>.\n", "debul> ) );
eo
sendaoce outputceo
ere debul file. Allaustoce ncesslcpro f()
ecessareci"escapes cf t.
No=eclrat4iuclrg"abovd ex 220alrg"DEBUG mssnPc>Olesel is setceo
0.
MssnPc>n atnlesel 0aalways pro . Brolcalll,lif lrg"mssnPc>Oleseltis
lssnitteIhor equal"eo
oce globalcvalue DEBUGLEVEL, mede lrg"DEBUG
statgme.t is procssned.
in/>outputcustoce abovd ex 220awoul"abeeeomethl:
cliky:
o/lis l:
">
[1998/07/30 16:00:51, 0] file.c:funcary.(128)
inis
is a debul mssnPc>.
Eachtcall"eo
DEBUG() cn-3 esca"new"heaper *unlssn*aoce outputcproduced
bycoce previoustcall"eo
DEBUG() did not end w meaa>'\n'.aOutputceo
oce
debul file is pdssedaehnangh a ecessareci"bufcrn whichtis
flushed
esery time a"newll:elis encou
red.cIf the bufcrn is
not e 2 y whec
DEBUG() istcallidrOlrg"new
iuputcis sittuyiappecded.
...but lre 'nivealll jeo aa Kludge.cItlwnsaputci.4223ce becaus
DEBUG() has beec ussdcto wrily>pd> ialcll:es. H/pe's atsN 220 (dumb)
ex 220aof the kindho
lthici"I'enoaltcnl about:
o/lis l:
">
DEBUG( 0, ("Tce ues creturnsdc> ) );
if( ues () )
DEBUG(0, ("True") );
else
DEBUG(0, ("False") );
DEBUG(0, (".\n") );
W meoutclrs
ecessaabufcrn,aoce outputc(assuml:
cles () returnsdctrue)
woul"alook liky>this:
o/lis l:
">
[1998/07/30 16:00:51, 0] file.c:funcary.(256)
ine ues creturnsd
[1998/07/30 16:00:51, 0] file.c:funcary.(258)
irue
[1998/07/30 16:00:51, 0] file.c:funcary.(261)
.
Whichtisn'thmuchtus . Trs
ecessaabufcrn kludge fixesFehis problem.
lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle> tfylessclear: both>n>csen m="ass=15508lresa>Tce DEBUGADD() Macroesh2 Optlemsptlemsuchmsptlemsptlemsp>
Ic addctLDIcto the kludgey eoluary.cto the brokec ll:elproblem
described
abovd,ctn/pe is a clean eoluary.. Trs
DEBUGADD() iucrotneser
gene
acestaaheaper.cItlwill"appecd new
uextFto the current debul
mssnPc> evTncif lrg"ecessaabufcrn is e 2 y.sin/>syIlax ustoce
DEBUGADD() iucrotis lrg"sn mcasctte custoce DEBUG() iucro.
o/lis l:
">
DEBUG( 0, ("Tcis
is lrg"f rst ll:e.\n" ) );
DEBUGADD( 0, ("Tcis
is lrg"second ll:e.\nTcis
is lrg"ehird ll:e.\n" ) );
Produceso/lis l:
">
[1998/07/30 16:00:51, 0] file.c:funcary.(512)
inis
is lrg"f rst ll:e.
inis
is lrg"second ll:e.
inis
is lrg"ehird ll:e.
lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle> tfylessclear: both>n>csen m="ass=15545lresa>Tce DEBUGLVL() Macroesh2 Optlemsptlemsuchmsptlemsptlemsp>
Oniaustoce problemtis meauc/ DEBUG() iucrotwasctte cDEBUG() ll:es
tendeditovgehaa
bit>long. Co si
rFehis ex 220ail
e
n ld_sendannou ce.c:
o/lis l:
">
DEBUG(3,("send_local_m=/pur_annou ceme.t: tefas%xifuraen mc%sore subneha%nifuracf tgnanpa%n\n",
tefa, global_myen m, subrec->subneh_en m, cf t->cf t_gnanp));
Oniaeoluary.cto this inito breakait
down usl:
cDEBUG() ad"aDEBUGADD(),
as follows:
o/lis l:
">
DEBUG( 3, ( "send_local_m=/pur_annou ceme.t: " ) );
DEBUGADD( 3, ( "tefas%xifuraen mc%so", tefa, global_myen m ) );
DEBUGADD( 3, ( "re subneha%ni", subrec->subneh_en m ) );
DEBUGADD( 3, ( "furacf tgnanpa%n\n", cf t->cf t_gnanp ) );
AtsN ilan, but argiablyanocsr approachtinito us oce DEBUGLVL() iucro.
This nacrotreturns iruelif lrg"mssnPc>Oleseltis lssnitteIhor equal"eo
oce globalcDEBUGLEVELcvalue, eo:
o/lis l:
">
if( DEBUGLVL( 3 ) )
{
dbgtext( "send_local_m=/pur_annou ceme.t: " );
dbgtext( "tefas%xifuraen mc%so", tefa, global_myen m );
dbgtext( "re subneha%ni", subrec->subneh_en m );
dbgtext( "furacf tgnanpa%n\n", cf t->cf t_gnanp );
}
(Tce dbgtext()"funcary.iis explaiuedFbelow.)in/pe ape a fewaadva agescto this scheme:n
ine ues cis>perecesedFonll rec/.
You can
allocaly>varinbles offv574oce stat ttte cwill"onll beeused
s mein oce DEBUGLVL() blckk.
Procssnlnl lre cis onll relesa geo
debul outputccan4b0 tt4"ained
s mein oce DEBUGLVL() blckk.
lang="en"msuch4n classtitlepage"msuchmsuchmsh24n classtitle> tfylessclear: both>n>csen m="ass=15638lresa>NewaFuncary.sesh2 Optlemsptlemsuchmsptlemsptlemsuch4n classsect2> lang="en"msuch4n classtitlepage"msuchmsuchmsh34n classtitle>n>csen m="ass=15644">esa>dbgtext()es
This funcary.iprincn debul mssnPc>OuextFto the debul file (and
passlblyaeo
syslog) via lrg"ecessaabufcrn. Trs
euncary.iusisia
varinble argindex lis jeo aliky>pro f() uraDebul1(). Trs
iuputcis pro edacneo
a bufcrn usl:
clrg"vslpro f() funcary.,
ad"athen pdssedaeo ecessa_debul_text().
If you us DEBUGLVL() you will"probablyapro lrg"body ustoce
mssnPc> usl:
cdbgtext().
lang="en"msuch4n classtitlepage"msuchmsuchmsh34n classtitle>n>csen m="ass=15660">esa>dbghdr()es
This is lrg"funcary.itte cwrilys
a debul mssnPc>aheaper.
Heapers ape not procssned via lrg"ecessaabufcrn. Alle no=eclrat
if lrg"ecessaabufcrn is not e 2 y,aa call"eo
dbghdr() will"not
produce any output.cSsetoce ctmadexs iu
dbghdr() for mo
Teinec.
Ittis not likyuyitte this funcary.iwill"be callid dirthely.cIt
is usedFbycDEBUG() ad"aDEBUGADD().
lang="en"msuch4n classtitlepage"msuchmsuchmsh34n classtitle>n>csen m="ass=15679aiesa>ecessa_debul_text()es
This is aFstftoc"funcary.iin debul.c.cItlsto
Tsaoce outputceext
furalrg"body ustoce mssnPc>Oin
a bufcrn u llcit encou
rsia
newll:e. Wede lrg"newll:elch>
acaivtis
fou drOlrg"bufcrn is
wriltec to the debul file via lrg"Debul1() funcary.,aad"alrg
bufcrn is veodt. This >llows uscto add lrg"inddexutle ta cthe
begieIcnl o
leachtll:elustoce mssnPc>Obody, nd"taleo ensuras
tte ctn/ outputcis wriltec atll:elat a time (whichttldans up
syslog output).
n>csaucssnkey="p"spann carchilycturm.html"rPrevesa> dr< d s dth="20%" allgn="ceccerlr>csaucssnkey="u"spann cpt02.html">Upesa>tn dr< d s dth="40%" allgn="right>n >csaucssnkey="n"spann c t&vyals.html"rNextesa>tn dr rr< rr< d s dth="40%" allgn="left> vallgn="top">Caspr>o 4. l"><Archilycturm dr< d s dth="20%" allgn="ceccerlr>csaucssnkey="h"spann c
.html">Homaesa>tn dr< d s dth="40%" allgn="right> vallgn="top"> Caspr>o 6. l"><I t&vyalstn dr rr nble>